package com.mgwt.phaseone.server;


import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;


/**
 * I extend the DB_Conn abstract class, then I don't have to rewrite code
 * 
 * @author branflake2267
 *
 */
public class DB_Church extends DB_Conn {

        /**
         * constructor - nothing to do
         */
        public DB_Church() {
                // nothing to do
        }
        
        
        /**
         * get how many verses are in a book
         * 
         * @param book
         * @return
         */
        public int checkuser(String username, String password) {
                

                String query = "SELECT * FROM user where username = '" + username + "'" + "and password = '" + password + "'";

                int rsSize = 0;
                try {
                        Connection connection = getConn();
                        Statement select = connection.createStatement();
                        ResultSet result = select.executeQuery(query);

                        rsSize = getResultSetSize(result); // size the array

                        // clean up
                        result.close();
                        connection.close();

                } catch (Exception e) {

                        System.err.println("Mysql Statement Error: " + query);
                        e.printStackTrace();

                }

                return rsSize;
                
        }
        
        
        
}
